﻿<Window x:Class="stockUploader.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Stock Uploader" Height="381" Width="515" MinWidth="515" MinHeight="300" Loaded="Window_Loaded"
    xmlns:converters="clr-namespace:stockUploader.Converters">
    <Window.Resources>
    </Window.Resources>
    <Grid Height="Auto" Width="Auto">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="75"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <TabControl HorizontalAlignment="Stretch">
            <TabItem Header="Files">
                <Grid Height="Auto" Name="grid1" Width="Auto" Margin="0">
                    <Grid.RowDefinitions>
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="252*" MinWidth="250"/>
                        <ColumnDefinition Width="241*" MinWidth="250"/>
                    </Grid.ColumnDefinitions>
                    <TreeView Margin="5,5,15,5" Name="tvFiles" Width="Auto" Grid.Column="0" >
                        <TreeView.ItemTemplate>
                            <HierarchicalDataTemplate ItemsSource="{Binding Path=SupportingFiles}">
                                <CheckBox Name="chkFile" Margin="2" IsChecked="{Binding Path=IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                    <StackPanel Orientation="Horizontal" >
                                        <Image Height="50" MaxWidth="100" Source="{Binding Path=FileInfo.FullName }" />
                                        <TextBlock Text="{Binding Path=FileInfo.Name}" VerticalAlignment="Center" />
                                    </StackPanel>
                                </CheckBox>
                            </HierarchicalDataTemplate>
                        </TreeView.ItemTemplate>
                        <TreeView.ItemContainerStyle>
                            <Style>
                                <Setter Property="TreeViewItem.IsExpanded" Value="True"/>
                            </Style>
                        </TreeView.ItemContainerStyle>
                    </TreeView>
                    <ListBox Margin="5" Name="lbStocks" Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" >
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <CheckBox Name="chkStock" Margin="2" IsChecked="{Binding Path=IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                    <TextBlock Text="{Binding Path=Stock.Ftp}" />
                                </CheckBox>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                    <GridSplitter Margin="0" Name="gridSplitter1" Width="10" />
                </Grid>

            </TabItem>
            <TabItem Header="Log">
                <!--<ListBox Name="lbLog">
                    <ListBox.ItemTemplate>
                        <DataTemplate DataType="stockUploader.LogItem" >
                            <StackPanel Orientation="Horizontal" Margin="0">
                                <StackPanel.Resources>
                                    <converters:NullableToVisibilityConverter x:Key="nullToVisibility"/>
                                </StackPanel.Resources>
                                <Label Width="110" Content="{Binding Path=DateTime}" ContentStringFormat="dd.MM.yy HH:mm:ss"/>
                                <Label Content="{Binding Path=File.Name}" />
                                <Label Content=" @ " />
                                <Label Content="{Binding Path=Stock.Name}" />
                                <Label Content="{Binding Path=Exception.Message}" Visibility="{Binding Path=Exception, Converter={StaticResource nullToVisibility}}" />
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>-->
                <TextBox Name="tbLog" />
            </TabItem>
        </TabControl>
        <Grid Grid.ColumnSpan="2" Grid.Row="1" Name="grid2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="75" />
                <ColumnDefinition Width="427*" />
            </Grid.ColumnDefinitions>
            <Grid Height="Auto" Name="grProgress" Width="Auto" Grid.Column="1" Margin="0,0,10,0">
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="120" />
                    <ColumnDefinition Width="288.183*" />
                    <ColumnDefinition Width="120" />
                </Grid.ColumnDefinitions>
                <Label Grid.ColumnSpan="1" Grid.RowSpan="1" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left" Margin="0" Name="lblImageName" Width="Auto">Image</Label>
                <Label Grid.ColumnSpan="1" Grid.RowSpan="1" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left" Margin="0" Name="lblStockName" Width="Auto">Stock</Label>
                <Label Grid.ColumnSpan="1" Grid.RowSpan="1" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Left" Margin="0" Name="lblTotalName" Width="Auto">Overall</Label>
                <ProgressBar Grid.Column="1" Grid.Row="0" Margin="7" Name="pbImage" />
                <ProgressBar Grid.Column="1" Grid.Row="1" Margin="7" Name="pbStock" />
                <ProgressBar Grid.Column="1" Grid.Row="2" Margin="7" Name="pbTotal" />
                <Label Grid.ColumnSpan="1" Grid.RowSpan="1" Grid.Column="2" Grid.Row="0" HorizontalAlignment="Right" Margin="0" Name="lblImageBytes" Width="Auto">Image</Label>
                <Label Grid.ColumnSpan="1" Grid.RowSpan="1" Grid.Column="2" Grid.Row="1" HorizontalAlignment="Right" Margin="0" Name="lblStockBytes" Width="Auto">Stock</Label>
                <Label Grid.ColumnSpan="1" Grid.RowSpan="1" Grid.Column="2" Grid.Row="2" HorizontalAlignment="Right" Margin="0" Name="lblTotalBytes" Width="Auto">Overall</Label>
            </Grid>
            <Button Grid.ColumnSpan="2" HorizontalAlignment="Left" Name="btnGo" Width="75" Click="btnGo_Click">GO</Button>
        </Grid>
    </Grid>

</Window>
